package com.kikikeji.weizhuo.data;

import android.content.Context;
import android.content.Intent;

import com.kikikeji.weizhuo.IconCache;
import com.kikikeji.weizhuo.LauncherAppState;
import com.kikikeji.weizhuo.activity.launchersetting.LauncherSettingsActivity;
import com.kikikeji.weizhuo.compat.LauncherActivityInfoCompat;
import com.kikikeji.weizhuo.compat.LauncherAppsCompat;
import com.kikikeji.weizhuo.compat.UserHandleCompat;

/**
 * Created by zhang on 2016/12/3.
 */

public class ItemInfoHelper {

    public static AppInfo makeLauncherSettingActivity(Context context) {
        final Intent intent = new Intent(context, LauncherSettingsActivity.class);
        LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
        UserHandleCompat user = UserHandleCompat.myUserHandle();
        LauncherActivityInfoCompat compat = launcherApps.resolveActivity(intent, user);
        LauncherAppState instance = LauncherAppState.getInstance();
        IconCache iconCache = instance.getIconCache();
        AppInfo appInfo = new AppInfo(context, compat, user, iconCache);
        return appInfo;
    }
}
